import 'dart:convert';

class RecommendResponesModel {
  List<RecommendModel>? list;

  RecommendResponesModel({this.list});

  factory RecommendResponesModel.fromRawJson(String str) =>
      RecommendResponesModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory RecommendResponesModel.fromJson(Map<String, dynamic> json) =>
      RecommendResponesModel(
        list: List<RecommendModel>.from(
          json["list"]!.map((x) => RecommendModel.fromJson(x)),
        ),
      );

  Map<String, dynamic> toJson() => {
    "list": List<dynamic>.from(list!.map((x) => x.toJson())),
  };
}

class RecommendModel {
  int? id;
  String? name;
  int? language;
  int? style;
  int? sort;
  int? showNumber;
  List<RecommendVideo>? recommendVideos;

  RecommendModel({
    this.id,
    this.name,
    this.language,
    this.style,
    this.sort,
    this.showNumber,
    this.recommendVideos,
  });

  factory RecommendModel.fromRawJson(String str) =>
      RecommendModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory RecommendModel.fromJson(Map<String, dynamic> json) => RecommendModel(
    id: json["id"],
    name: json["name"],
    language: json["language"],
    style: json["style"],
    sort: json["sort"],
    showNumber: json["show_number"],
    recommendVideos: List<RecommendVideo>.from(
      json["recommend_videos"].map((x) => RecommendVideo.fromJson(x)),
    ),
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "name": name,
    "language": language,
    "style": style,
    "sort": sort,
    "show_number": showNumber,
    "recommend_videos": List<dynamic>.from(
      recommendVideos!.map((x) => x.toJson()),
    ),
  };
}

class RecommendVideo {
  int? videoId;
  String? name;
  String? description;
  String? imgUrl;
  List<dynamic>? tags;
  int? lastWatchEpisodesId;

  RecommendVideo({
    this.videoId,
    this.name,
    this.description,
    this.imgUrl,
    this.tags,
    this.lastWatchEpisodesId,
  });

  factory RecommendVideo.fromRawJson(String str) =>
      RecommendVideo.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  factory RecommendVideo.fromJson(Map<String, dynamic> json) => RecommendVideo(
    videoId: json["video_id"],
    name: json["name"],
    description: json["description"],
    imgUrl: json["img_url"],
    tags: List<dynamic>.from(json["tags"].map((x) => x)),
    lastWatchEpisodesId: json["last_watch_episodes_id"],
  );

  Map<String, dynamic> toJson() => {
    "video_id": videoId,
    "name": name,
    "description": description,
    "img_url": imgUrl,
    "tags": List<dynamic>.from(tags!.map((x) => x)),
    "last_watch_episodes_id": lastWatchEpisodesId,
  };
}
